//
//  HMComposeButton.swift
//  HMWeibo12
//
//  Created by iOS on 16/9/25.
//  Copyright © 2016年 iOS. All rights reserved.
//

import UIKit

class HMComposeButton: UIControl {

    @IBOutlet weak var imageView: UIImageView!

    @IBOutlet weak var textLabel: UILabel!
    
    var model: HMComposeButtonModel? {
        didSet {
            imageView.image = UIImage(named: model?.icon ?? "")
            textLabel.text = model?.title
        }
    }
    
    class func composeButton(model: HMComposeButtonModel) -> HMComposeButton {
        let button = Bundle.main.loadNibNamed("HMComposeButton", owner: nil, options: nil)?.last as! HMComposeButton
        
        button.model = model
        
        return button
    }
}
